/*
*
* 创建方法的学习
*
* 2022.1.15
* */

package OrientProject;

import com.sun.org.apache.bcel.internal.generic.ARETURN;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MatchGenerator;

public class ObjectTest {

    public static void main(String[] args) {
        Person p1 = new Person();

        p1.name = "Tom";
        p1.age = 18;
        p1.sex = 1;

        p1.study();

        p1.showAge();

        int age1 = p1.addAge(2);
        System.out.println(age1);
    }
}

class Person{

    String name;
    int age;

    /*
    *
    * sex:1表明是男性
    * sex：2表明是女性
    * */
    int sex;

    public void study(){
        System.out.println("Studying");
    }

    public void showAge(){
        System.out.println("age" + age);
    }

    public int addAge(int i){
        age += i;
        return age;
    }
}


